from appium import webdriver
import time
from appium.webdriver.common.appiumby import By

# 连接配置
# 连接配置信息
des = {
    "platformName": "Android",
    "platformVersion": "7.1.2",
    "deviceName": "emulator-5554",
    "appPackage": "com.android.settings",
    "appActivity": ".Settings"
}
# 初始化驱动对象
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", des)

# 点击-放大镜
driver.find_element(By.ID, "com.android.settings:id/search").click()
time.sleep(2)
# 输入-坚果
driver.find_element(By.CLASS_NAME, "android.widget.EditText").send_keys("坚果")
time.sleep(5)
driver.quit()